#!/bin/bash


echo '生成根证书...'
cfssl gencert -initca ca-csr.json | cfssljson -bare ca

echo '生成客户端证书...'
cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=www client-csr.json | cfssljson -bare client

echo '生成服务器证书...'
cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=www server-csr.json | cfssljson -bare server

echo '删除 csr ...'
rm -rf *.csr